<!DOCTYPE html>
<html lang="zh-CN">
  <head>
	<meta charset="utf-8">
	<title>搜索引擎测试</title>
	<style type="text/css">
		em {color:red;}
		span {font-size:13px}
		eg {color:green;font-size:13px}
		eg a{color:green;font-size:13px}
	</style>
	<body>
	<form action="search.php" method="post">
		搜索内容:<input type="text" name="content" />
		<input type="submit" />
	</form>
	</body>
	
  </head>
 <body>
	 
<?php 
require 'xunsearch.class.php';
$xs = new xunsearch;
$xs->proj_name = 'edu270_resources';				//项目名称

if(isset($_POST['content'])){
	$searchcontent = $_POST['content'];				//搜索内容
	$highlight = array('title','content','user_name','grade_name','subject_name','type_name');	//高亮字段
	$order = 'addtime';								//排序字段
	$total = $xs->getTotal();						//获取项目数据总数总数
	$count = $xs->xxount($searchcontent);			//获取匹配总数
	$data = $xs->Allsearch(0,10,$searchcontent,$highlight,$order);	//起始条数	查询条数  搜索内容	高亮字段数组  排序字段

	echo '<br />为您找到相关结果约'.$count.'个<br />';
	foreach($data as $key => $value){
		echo '<a target="_blank" href="'.$value['con_path'].'">'.$value['title'].'</a>';
		echo '<br />';
		echo '<span>'.$value['content'].'</span>';
		echo '<br />';
		echo '<span>类型：'.$value['type_name'].'&nbsp;&nbsp;&nbsp;&nbsp;上传者：'.$value['user_name'].'&nbsp;&nbsp;&nbsp;&nbsp;学校：'.$value['school_name'].'&nbsp;&nbsp;&nbsp;&nbsp;年级：'.$value['grade_name'].'&nbsp;&nbsp;&nbsp;&nbsp;学科：'.$value['subject_name'].'</span>';
		echo '<br />';
		echo '<eg>下载：<a href="'.$value['down_url'].'">'.$value['down_url'].'</a></eg>';
		echo '<br />';
		echo '<br />';
	}
}
?>
 </body>
</html>
